#include "file.h"
#include "ui_file.h"
#include <QSettings>
#include "QDebug"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <linux/types.h>
#include <linux/netlink.h>
#include <errno.h>
#include <unistd.h>


#define  TEST_INI "/opt/Test.ini"

File::File(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::File)
{
    ui->setupUi(this);
}

File::~File()
{
    delete ui;
}

void File::on_pushButton_released()
{
    QSettings settings(TEST_INI, QSettings::IniFormat);
    settings.setValue("TRANX",55);
    settings.setValue("TRANY", 1);
    settings.setValue("ROAT", 22);
    settings.setValue("SCALE", 78);
    settings.setValue("Used", 15);
    sync();
    qDebug()<<"TRANX:55"<<"TRANY:1"<<"ROAT:22"<<"SCALE:78"<<"Used:15";
}


void File::on_pushButton_2_released()
{
    int m_nTPLXTran,m_nTPLYTran,m_nTPLRoat,m_nTPLScale,m_bSetTPLInfo;
    QSettings fileTPL(TEST_INI, QSettings::IniFormat);
    m_nTPLXTran = fileTPL.value("TRANX", QVariant(int())).toInt();
    m_nTPLYTran = fileTPL.value("TRANY", QVariant(int())).toInt();
    m_nTPLRoat = fileTPL.value("ROAT", QVariant(int())).toInt();
    m_nTPLScale = fileTPL.value("SCALE", QVariant(int())).toInt();
    m_bSetTPLInfo = fileTPL.value("Used", QVariant(int())).toBool();
    sync();
    qDebug()<<"m_nTPLXTran"<<m_nTPLXTran<<"m_nTPLYTran"<<m_nTPLYTran<<"m_nTPLRoat"<<m_nTPLRoat;
    qDebug()<<"m_nTPLScale"<<m_nTPLScale<<"m_bSetTPLInfo"<<m_bSetTPLInfo;

}
